//
//  IdeaDetallTableViewCell.m
//  LiangYa_BObject
//
//  Created by dllo on 15/10/29.
//  Copyright © 2015年 YuHao. All rights reserved.
//

#import "IdeaDetallTableViewCell.h"

@implementation IdeaDetallTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    self.contentView.backgroundColor = [UIColor clearColor];
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.backImageView = [[UIImageView alloc] init];
        if ([[NSUserDefaults standardUserDefaults]boolForKey:@"nightstyle"]) {
            _backImageView.backgroundColor = [UIColor colorWithRed:57/255.0 green:57/255.0 blue:57/255.0 alpha:1];
        }else{
            _backImageView.backgroundColor = [UIColor whiteColor];
        }
        self.backImageView.layer.cornerRadius = 10;
        self.backImageView.layer.masksToBounds = YES;
        [self.contentView addSubview:self.backImageView];
        
        self.picImageView = [[UIImageView alloc] init];
        [self.backImageView addSubview:self.picImageView];
        
        self.priceLabel = [[NightLabel alloc] init];
        self.priceLabel.textAlignment = NSTextAlignmentCenter;
        self.priceLabel.backgroundColor = [UIColor colorWithWhite:0.6 alpha:0.7];
        self.priceLabel.textColor = [UIColor whiteColor];
        self.priceLabel.font = [UIFont systemFontOfSize:11];
        self.priceLabel.layer.cornerRadius = 20;
        self.priceLabel.layer.masksToBounds = YES;
        self.priceLabel.layer.borderWidth = 2;
        self.priceLabel.layer.borderColor = [[UIColor whiteColor] CGColor];
        
        [self.contentView addSubview:self.priceLabel];
        
        self.detailLabel = [[NightLabel alloc] init];
        self.detailLabel.font = [UIFont systemFontOfSize:14];
        self.detailLabel.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:self.detailLabel];
        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    _backImageView.frame = CGRectMake(5, 5, cellWidth - 10, cellHeight - 7);
    _picImageView.frame = CGRectMake(0, 0, cellWidth - 10,250);
    _priceLabel.frame = CGRectMake(cellWidth - 60, 235, 40, 40);
    _detailLabel.frame = CGRectMake(10, 275, cellWidth - 20,20);
    self.detailLabel.numberOfLines = 0;
    [self.detailLabel sizeToFit];
    self.backgroundColor = [UIColor clearColor];
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
